package com.north.light.libpicselect.utils;

import com.north.light.libpicselect.bean.LibMediaType;
import com.north.light.libpicselect.bean.LibPicInfo;

import java.io.Serializable;

/**
 * FileName: LibMediaTypeUtils
 * Author: lzt
 * Date: 2022/7/2 9:53
 * 多媒体类型工具类
 */
public class LibMediaTypeUtils implements Serializable {


    private static final class SingleHolder {
        static final LibMediaTypeUtils mInstance = new LibMediaTypeUtils();
    }

    public static LibMediaTypeUtils getInstance() {
        return LibMediaTypeUtils.SingleHolder.mInstance;
    }

    /**
     * 判断媒体是否为图片
     */
    public boolean isPic(LibPicInfo info) {
        if (info == null) {
            return false;
        }
        int source = info.getSource();
        return source == LibMediaType.PIC.getSource();
    }

    /**
     * 判断媒体是否为视频
     */
    public boolean isVideo(LibPicInfo info) {
        if (info == null) {
            return false;
        }
        int source = info.getSource();
        return source == LibMediaType.VIDEO.getSource();
    }
}
